<?php

class Session
{
	static protected $_started = FALSE;

	private function __construct()
	{
	}

	static public function setHandler($handler)
	{

		// set object as the save handler
		session_set_save_handler(array(
			&$handler,
			'open'
		), array(
			&$handler,
			'close'
		), array(
			&$handler,
			'read'
		), array(
			&$handler,
			'write'
		), array(
			&$handler,
			'destroy'
		), array(
			&$handler,
			'gc'
		));
	}

	static public function start()
	{

		if (self::$_started)
		{
			return TRUE;
		}

		self::setHandler(new Session_Mongo);

		session_start();

		self::$_started = TRUE;
	}

}
